/*
 * @lc app=leetcode.cn id=1566 lang=javascript
 *
 * [1566] 重复至少 K 次且长度为 M 的模式
 */

// @lc code=start
/**
 * @param {number[]} arr
 * @param {number} m
 * @param {number} k
 * @return {boolean}
 */
var containsPattern = function (arr, m, k) {
  let str = arr.toString();
  let sub = i => str.slice(i, i + m + m - 1);
  for (let i = 0; i + m * k < str.length; i++) {
    if (str[i] === ',') continue;
    let repeatSub = (sub(i) + ',').repeat(k).slice(0, -1);
    if (str.includes(repeatSub)) return true;
  }
  return false;
};
// @lc code=end

